// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   JimuReportDictController.java

package com.fuxi.cloud.desreport.a;

import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.fuxi.cloud.common.constant.CommonConstant;
import com.fuxi.cloud.common.util.JimuReportRepository;
import com.fuxi.cloud.common.util.oConvertUtils;
import com.fuxi.cloud.common.vo.Result;
import com.fuxi.cloud.config.client.JmReportTokenClient;
import com.fuxi.cloud.desreport.entity.JimuReportDict;
import com.fuxi.cloud.desreport.service.IJimuReportDictService;

public class b
{

    public b()
    {
    }

    public Result a(JimuReportDict jimureportdict, Integer integer, Integer integer1, HttpServletRequest httpservletrequest)
    {
        Result result = new Result();
        String s = jimuTokenClient.getUsername(httpservletrequest);
        if(JimuReportRepository.getSaas().booleanValue())
            jimureportdict.setCreateBy(s);
        jimureportdict.setDelFlag(CommonConstant.DEL_FLAG_0);
        com.fuxi.cloud.desreport.model.JmPage jmpage = dictService.queryPageList(jimureportdict, integer, integer1);
        result.setSuccess(true);
        result.setResult(jmpage);
        return result;
    }

    public Result a(JimuReportDict jimureportdict, HttpServletRequest httpservletrequest)
    {
        Result result = new Result();
        String s = jimuTokenClient.getUsername(httpservletrequest);
        Integer integer = dictService.getDictCount(jimureportdict.getDictCode());
        if(integer.intValue() > 0)
        {
            result.setSuccess(false);
            result.setMessage("\u5B57\u5178\u7F16\u7801\u5DF2\u5B58\u5728\uFF01");
            return result;
        } else
        {
            jimureportdict.setCreateTime(new Date());
            jimureportdict.setDelFlag(CommonConstant.DEL_FLAG_0);
            jimureportdict.setCreateBy(s);
            dictService.save(jimureportdict);
            result.setSuccess(true);
            result.success("\u4FDD\u5B58\u6210\u529F\uFF01");
            return result;
        }
    }

    public Result a(JimuReportDict jimureportdict)
    {
        Result result = new Result();
        JimuReportDict jimureportdict1 = dictService.getById(jimureportdict.getId());
        Integer integer = dictService.getEditDictCount(jimureportdict.getDictCode(), jimureportdict.getId());
        if(integer.intValue() > 0)
        {
            result.setSuccess(false);
            result.setMessage("\u5B57\u5178\u7F16\u7801\u5DF2\u5B58\u5728\uFF01");
            return result;
        }
        if(jimureportdict1 == null)
        {
            result.error500("\u672A\u627E\u5230\u5BF9\u5E94\u5B9E\u4F53");
        } else
        {
            jimureportdict.setUpdateTime(new Date());
            int i = dictService.updateById(jimureportdict).intValue();
            if(i > 0)
                result.success("\u7F16\u8F91\u6210\u529F!");
        }
        return result;
    }

    public Result a(String s)
    {
        Result result = new Result();
        int i = dictService.updateDictDelFlag(CommonConstant.DEL_FLAG_1, s);
        if(i > 0)
            result.success("\u5220\u9664\u6210\u529F!");
        else
            result.error500("\u5220\u9664\u5931\u8D25!");
        return result;
    }

    public Result b(String s)
    {
        try
        {
            dictService.deleteOneDictPhysically(s);
            return Result.ok("\u5220\u9664\u6210\u529F!");
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
        return Result.error("\u5220\u9664\u5931\u8D25!");
    }

    public Result c(String s)
    {
        Result result = new Result();
        if(oConvertUtils.isEmpty(s))
        {
            result.error500("\u53C2\u6570\u4E0D\u8BC6\u522B\uFF01");
        } else
        {
            dictService.updateDelFlagByIds(s);
            result.success("\u5220\u9664\u6210\u529F!");
        }
        return result;
    }

    public Result a(HttpServletRequest httpservletrequest)
    {
        Result result = new Result();
        String s = jimuTokenClient.getUsername(httpservletrequest);
        return Result.OK("\u5237\u65B0\u7F13\u5B58\u6210\u529F!");
    }

    public Result b(HttpServletRequest httpservletrequest)
    {
        String s = jimuTokenClient.getUsername(httpservletrequest);
        Result result = new Result();
        if(!JimuReportRepository.getSaas().booleanValue())
            s = "";
        java.util.List list = dictService.queryDeleteList(s);
        result.setSuccess(true);
        result.setResult(list);
        return result;
    }

    public Result b(JimuReportDict jimureportdict)
    {
        try
        {
            dictService.updateDictDelFlag(CommonConstant.DEL_FLAG_0, jimureportdict.getId());
            return Result.ok("\u53D6\u56DE\u6210\u529F!");
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
        return Result.error("\u64CD\u4F5C\u5931\u8D25!");
    }

    private IJimuReportDictService dictService;
    private JmReportTokenClient jimuTokenClient;
}
